//
//   RANetWorkUtil.h
//  RayoSmartBleKey
//
//  Created by Piccolo on 2017/8/6.
//  Copyright © 2017年 Piccolo. All rights reserved.
//

#import "AFNetworking.h"

#define RA_SINGLE_TOKEN_QUERY_STRING [RANetWorkUtil singleTokenQueryString]

@interface  RANetWorkUtil : NSObject

+ (BOOL)netWorkIsOn;

+ (NSRANetWorkType)netWorkType;

+ (NSString *)userAgent;

+ (NSString *)singleTokenQueryString;

+ (void)GET:(NSString *)URLString
 parameters:(id)parameters
   progress:(void (^)(NSProgress *downloadProgress))downloadProgress
    success:(void (^)(NSURLSessionDataTask *dataTask, id responseObject))success
    failure:(void (^)(NSURLSessionDataTask *dataTask, NSError *error))failure;

+ (void)POST:(NSString *)URLString
  parameters:(id)parameters
    progress:(void (^)(NSProgress * uploadProgress))uploadProgress
     success:(void (^)(NSURLSessionDataTask * task, id responseObject))success
     failure:(void (^)(NSURLSessionDataTask * task, NSError * error))failure;

+ (void)POST:(NSString *)URLString
  parameters:(id)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
    progress:(void (^)(NSProgress * uploadProgress))uploadProgress
     success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
     failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;

+ (void)PUT:(NSString *)URLString
 parameters:(id)parameters
    success:(void (^)(NSURLSessionDataTask *task, id responseObject))success
    failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure;

+ (void)PUT:(NSString *)URLString
 parameters:(id)parameters
constructingBodyWithBlock:(void (^)(id <AFMultipartFormData> formData))block
   progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock
    success:(void (^)(NSURLResponse *response, id responseObject))success
    failure:(void (^)(NSURLResponse * response, NSError *error))failure
      error:(NSError *__autoreleasing *)requestError;

@end
